package project.rbac.exception;

/**
 * 异常统一处理工具类
 *
 * @author 刘嘉薏
 * @since 2025/6/15 15:36
 */
public class ExceptionHandler {
    private ExceptionHandler() {
    }
    private static void printError(String message) {
        System.out.println("\033[31m" + message + "\033[0m");
    }
    public static void handle(Exception e){
        if (e instanceof FatalException){
            printError(e.getMessage());
            System.exit(1);
            return;
        }
        if (e instanceof BaseRuntimeException) {
            printError(e.getMessage());
            return;
        }
        printError(e.getMessage());
    }
}
